import {ref,reactive} from 'vue'
import {defineStore} from 'pinia'
import { noticeListGet, noticePageGet} from '@/api/noticeApi.js';

export const useNoticeStore = defineStore('notice', () => {

const noticePage = ref([])
const noticeList = ref([])
const pagination = reactive({
    current:1,
    total:0
})

async function getNoticePage(query = {}) {
let {records, current, total} =await noticePageGet(query)
noticePage.value = records
pagination.current = current
pagination.total = total
}

async function getNoticeList(query = {}) {
noticeList.value = await noticeListGet(query)
}


return {
pagination,
noticePage, getNoticePage,getNoticeList}
})
